# docker-compose版本
version: "3.8"
# 定义服务
services:
{% for service in services %}
   redis-{{service.port}}: # 服务名称
        image: redis:7.0
        container_name: redis-{{service.port}} # 启动容器的名称
        restart: always # 容器随着docker启动而启动
        ports:
          - {{service.port}}:{{service.port}}
          - 1{{service.port}}:1{{service.port}}
        volumes: # 数据卷 ，工作目录挂载
          - {{service.conf}}/redis.conf:/usr/local/etc/redis/redis.conf
          - {{service.data}}:/data
        command: redis-server /usr/local/etc/redis/redis.conf  # 启动容器命令
{% endfor %}